package com.able.wanandroid.utils;

import android.content.Context;
import android.widget.Toast;

import es.dmoral.toasty.Toasty;

/**
 * 封装Toast工具类，使用第三方库Toasty
 *
 * @author Able
 * @date 2018/3/21
 */
public class ToastUtils {

    public static void showToast(Context context, CharSequence msg) {
        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
    }

    public static void showInfo(Context context, CharSequence msg) {
        Toasty.info(context, msg, Toast.LENGTH_SHORT, false).show();
    }

    public static void showInfo(Context context, CharSequence msg, boolean withIcon) {
        Toasty.info(context, msg, Toast.LENGTH_SHORT, withIcon).show();
    }

    public static void showSuccess(Context context, CharSequence msg) {
        Toasty.success(context, msg, Toast.LENGTH_SHORT, false).show();
    }

    public static void showSuccess(Context context, CharSequence msg, boolean withIcon) {
        Toasty.success(context, msg, Toast.LENGTH_SHORT, withIcon).show();
    }

    public static void showWarning(Context context, CharSequence msg) {
        Toasty.warning(context, msg, Toast.LENGTH_SHORT, false).show();
    }

    public static void showWarning(Context context, CharSequence msg, boolean withIcon) {
        Toasty.warning(context, msg, Toast.LENGTH_SHORT, withIcon).show();
    }

    public static void showError(Context context, CharSequence msg) {
        Toasty.error(context, msg, Toast.LENGTH_SHORT, false).show();
    }

    public static void showError(Context context, CharSequence msg, boolean withIcon) {
        Toasty.error(context, msg, Toast.LENGTH_SHORT, withIcon).show();
    }

    public static void showError(Context context, CharSequence msg, int duration) {
        Toasty.warning(context, msg, duration).show();
    }
}
